﻿using OpenCompiler.AST;
using OpenCompiler.Scanning;

namespace OpenCompiler.LanguageElements
{
	public class Struct : ILanguageElement
	{
		public Statement Generate(Statement statement, Token[] tokens, int tokenIndex, out int tokensUsed)
		{
			tokensUsed = 0;
			var namespaceStatement = statement as NamespaceStatement;
			if( null != namespaceStatement )
			{
				var name = tokens[tokenIndex + 1].ActualToken.ToString();
				var result = namespaceStatement.Types.Struct(name);
				// Todo: validate if class is a mix of modifers that aren't allowed

				tokensUsed++;
				return result;
			}
			return statement;

		}
	}
}
